import request from "@/common/Ask";
import type { Menu } from "@/interface/Menu";
import type { Query } from "@/interface/Query"
import type { Page } from "@/interface/Page";

export async function listApi( data : Query ) {
    return request<Page<Menu>>({
        url: 'menu/list',
        method: 'post',
        data: data
    });
}

export async function operatorApi( data : Menu ) {
    return request<any>({
        url: 'menu/operator',
        method: 'put',
        data: data
    });
}


export async function deleteApi( id : string ) {
    return request<any>({
        url: 'menu/delete/' + id,
        method: 'delete'
    });
}
export async function oneIdApi( id : string ) {
    return request<Menu>({
        url: 'menu/id/' + id,
        method: 'get'
    });
}

export async function treeNodeApi( keyWord? : string ) {
    return request<Menu[]>({
        url: keyWord ? 'menu/treeNode/' + keyWord : 'menu/treeNode',
        method: 'get'
    });
}

